package edu.jmu.transaction;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("accountService")
public class AccountServiceImpl implements AccountService {

	private AccountDao accountDao;
	
	@Autowired
	public void setAccountDao(AccountDao accountDao) {
		this.accountDao = accountDao;
	}


	@Override
	public void transfer(String from, String to, int money) {
		accountDao.transferFrom(from, money);
		accountDao.displayAllAccount();
		//int x = 1/0;//转账途中抛出异常
		accountDao.transferTo(to, money);
	}

}
